#
# OpenSSL/engines/afalg/Makefile
#

DIR=	afalg
TOP=	../..
CC=	cc
INCLUDES= -I../../include
CFLAG=-g
MAKEFILE=	Makefile
AR=		ar r

CFLAGS= $(INCLUDES) $(CFLAG) $(SHARED_CFLAG)
LIB=$(TOP)/libcrypto.a

LIBNAME=afalg
LIBSRC=	e_afalg.c
LIBOBJ=	e_afalg.o e_afalg_err.o

SRC= $(LIBSRC)

top:
	(cd $(TOP); $(MAKE) DIRS=engines sub_all)

all: errors lib

errors:
	$(PERL) $(TOP)/util/mkerr.pl -conf e_afalg.ec -nostatic -write $(SRC)

lib: $(LIBOBJ)
	@if [ "$(DYNAMIC_ENGINES)" = 1 ]; then \
		$(MAKE) -f $(TOP)/Makefile.shared -e \
			LIBNAME=$(LIBNAME) \
			LIBEXTRAS='$(LIBOBJ)' \
			LIBDEPS='-L$(TOP) -lcrypto' \
			link_dso.$(SHLIB_TARGET); \
	else \
		$(AR) $(LIB) $(LIBOBJ); \
	fi
	@touch lib

install:
	@[ -n "$(INSTALLTOP)" ] # should be set by top Makefile...
	@if [ -n "$(SHARED_LIBS)" ]; then \
		set -e; \
		$(PERL) $(TOP)/util/mkdir-p.pl $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/engines; \
		cp $(LIBNAME)$(DSO_EXT) $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/engines/$(LIBNAME)$(DSO_EXT).new; \
		chmod 555 $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/engines/$(LIBNAME)$(DSO_EXT).new; \
		mv -f $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/engines/$(LIBNAME)$(DSO_EXT).new $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/engines/$(LIBNAME)$(DSO_EXT); \
	fi


depend:
	@[ -z "$(THIS)" ] || $(TOP)/util/domd $(CFLAG) $(INCLUDES) $(DEPFLAG) -- $(PROGS) $(LIBSRC) $(TESTLIBSRC)

clean:
	rm -f *.s *.o *.obj lib tags core .pure .nfs* *.old *.bak fluff *.so *.dll *.dylib

# DO NOT DELETE THIS LINE -- make depend depends on it.
e_afalg.o: e_afalg.c ../../include/openssl/engine.h \
 ../../include/openssl/opensslconf.h ../../include/openssl/bn.h \
 ../../include/openssl/e_os2.h ../../include/openssl/ossl_typ.h \
 ../../include/openssl/crypto.h ../../include/openssl/stack.h \
 ../../include/openssl/safestack.h ../../include/openssl/opensslv.h \
 ../../include/openssl/symhacks.h ../../include/openssl/rsa.h \
 ../../include/openssl/asn1.h ../../include/openssl/bio.h \
 ../../include/openssl/dsa.h ../../include/openssl/dh.h \
 ../../include/openssl/ec.h ../../include/openssl/rand.h \
 ../../include/openssl/ui.h ../../include/openssl/err.h \
 ../../include/openssl/lhash.h ../../include/openssl/x509.h \
 ../../include/openssl/buffer.h ../../include/openssl/evp.h \
 ../../include/openssl/objects.h ../../include/openssl/obj_mac.h \
 ../../include/openssl/sha.h ../../include/openssl/x509_vfy.h \
 ../../include/openssl/pkcs7.h ../../include/openssl/async.h e_afalg.h \
 e_afalg_err.h
